{% extends "common/default.html" %}
{% block common %}
    <script type="text/javascript">
        function checkForm() {
            var courseName = $("#courseName").val();
            var credit = $("#credit").val();
            var teacherId = $("#teacherId").val();
            if (courseName == null || courseName == "") {
                $("#error").html("课程名称不能为空！");
                return false;
            }
            if (credit == null || credit == "") {
                $("#error").html("学分不能为空！");
                return false;
            }
            if (teacherId == null || teacherId == "") {
                $("#error").html("请选择授课老师！");
                return false;
            }
            return true;
        }

        function resetValue() {
            $("#courseName").val("");
            $("#credit").val("");
            $("#teacherId").val("");
        }
    </script>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{{ dataType }}</h3>
        </div>
        <div class="panel-body">
            <form class="form-horizontal" role="form" method="post" action="../manager/manager_add"
                  onsubmit="checkForm()">
                {% if error %}
                    <label style="background-color: red">{{ error }}</label>
                {% endif %}
                {% if success %}
                    <label style="background-color: green">{{ success }}</label>
                    <a href="../manager/course_list">点击去查看</a>
                {% endif %}
                <div class="form-group">
                    <label class="col-md-2 control-label">课程名称：</label>
                    <div class="col-md-10">
                        <input type="text" class="form-control" id="teacherId" name="teacherId" style="width: 300px;"
                               value="{{ course.courseName }}" readonly="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">学分：</label>
                    <div class="col-md-10">
                        <input type="text" class="form-control" id="teacherId" name="teacherId" style="width: 300px;"
                               value="{{ course.credit }}" readonly="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">授课老师：</label>
                    <div class="col-md-10">
                        <input type="text" class="form-control" id="teacherId" name="teacherId" style="width: 300px;"
                               value="{{ course.teacherId.trueName }}" readonly="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">开始周：</label>
                    <div class="col-md-10">
                        <input type="text" class="form-control" id="teacherId" name="teacherId" style="width: 300px;"
                               value="{{ course.startTime }}" readonly="true">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">结束周：</label>
                   <div class="col-md-10">
                        <input type="text" class="form-control" id="teacherId" name="teacherId" style="width: 300px;"
                                value="{{ course.endTime }}" readonly="true">
                    </div>
                </div>
            <div class="form-group">
                    <label class="col-md-2 control-label">上课时间：</label>
                   <div class="col-md-10">
                        <input type="text" class="form-control" id="teacherId" name="teacherId" style="width: 300px;"
                                value="{{ times }}" readonly="true">
                    </div>
                </div>
            </form>
        </div>
    </div>
{% endblock %}

